<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回包含密钥详情的数组</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.openssl-pkey-get-details" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_pkey_get_details</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_pkey_get_details</span> &mdash; <span class="dc-title">返回包含密钥详情的数组</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-pkey-get-details-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_pkey_get_details</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$key</code></span>
   ) : <span class="type">array</span></div>

  <p class="para rdfs-comment">
   该函数返回密钥详情(位长度，密钥，类型).
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-pkey-get-details-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">key</code></dt>

     <dd>

      <p class="para">
      持有密钥的资源。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-pkey-get-details-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功，返回包含密钥详情的数组，失败返回 <strong><code>FALSE</code></strong> .
   返回的数组中包含了如下索引： <em>bits</em> (位数),
   <em>key</em> (表示公钥的字符串) 和
   <em>type</em> (如下密钥类型之一：
   <strong><code>OPENSSL_KEYTYPE_RSA</code></strong>,
   <strong><code>OPENSSL_KEYTYPE_DSA</code></strong>,
   <strong><code>OPENSSL_KEYTYPE_DH</code></strong>,
   <strong><code>OPENSSL_KEYTYPE_EC</code></strong> 或者 未知类型返回1).
  </p>
  <p class="para">
   取决于所使用密钥的类型，可能会返回其他额外的信息。请注意，有些元素可能并不总是可用的。
  </p>
  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <strong><code>OPENSSL_KEYTYPE_RSA</code></strong>, 一个额外的键名为 <em>&quot;rsa&quot;</em>的数组，包含了以下密钥数据：
    </span>
     <table class="doctable informaltable">
      
       <thead>
        <tr>
         <th>Key</th>
         <th>说明</th>
        </tr>

       </thead>

       <tbody class="tbody">
        <tr>
         <td><em>&quot;n&quot;</em></td>
         <td>modulus</td>
        </tr>

        <tr>
         <td><em>&quot;e&quot;</em></td>
         <td>public exponent</td>
        </tr>

        <tr>
         <td><em>&quot;d&quot;</em></td>
         <td>private exponent</td>
        </tr>

        <tr>
         <td><em>&quot;p&quot;</em></td>
         <td>prime 1</td>
        </tr>

        <tr>
         <td><em>&quot;q&quot;</em></td>
         <td>prime 2</td>
        </tr>

        <tr>
         <td><em>&quot;dmp1&quot;</em></td>
         <td>exponent1, d mod (p-1)</td>
        </tr>

        <tr>
         <td><em>&quot;dmq1&quot;</em></td>
         <td>exponent2, d mod (q-1)</td>
        </tr>

        <tr>
         <td><em>&quot;iqmp&quot;</em></td>
         <td>coefficient, (inverse of q) mod p</td>
        </tr>

       </tbody>
      
     </table>

   </li>
   <li class="listitem">
    <span class="simpara">
     <strong><code>OPENSSL_KEYTYPE_DSA</code></strong>, 一个额外的键为 <em>&quot;dsa&quot;</em> 的数组， 
     包含如下的密钥数据。
    </span>
     <table class="doctable informaltable">
      
       <thead>
        <tr>
         <th>Key</th>
         <th>说明</th>
        </tr>

       </thead>

       <tbody class="tbody">
        <tr>
         <td><em>&quot;p&quot;</em></td>
         <td>prime number (public)</td>
        </tr>

        <tr>
         <td><em>&quot;q&quot;</em></td>
         <td>160-bit subprime, q | p-1 (public)</td>
        </tr>

        <tr>
         <td><em>&quot;g&quot;</em></td>
         <td>generator of subgroup (public)</td>
        </tr>

        <tr>
         <td><em>&quot;priv_key&quot;</em></td>
         <td>private key x</td>
        </tr>

        <tr>
         <td><em>&quot;pub_key&quot;</em></td>
         <td>public key y = g^x</td>
        </tr>

       </tbody>
      
     </table>

   </li>
   <li class="listitem">
    <span class="simpara">
     <strong><code>OPENSSL_KEYTYPE_DH</code></strong>, 一个额外的键为 <em>&quot;dh&quot;</em> 的数组，包含如下的密钥数据。
    </span>
     <table class="doctable informaltable">
      
       <thead>
        <tr>
         <th>Key</th>
         <th>说明</th>
        </tr>

       </thead>

       <tbody class="tbody">
        <tr>
         <td><em>&quot;p&quot;</em></td>
         <td>prime number (shared)</td>
        </tr>

        <tr>
         <td><em>&quot;g&quot;</em></td>
         <td>generator of Z_p (shared)</td>
        </tr>

        <tr>
         <td><em>&quot;priv_key&quot;</em></td>
         <td>private DH value x</td>
        </tr>

        <tr>
         <td><em>&quot;pub_key&quot;</em></td>
         <td>public DH value g^x</td>
        </tr>

       </tbody>
      
     </table>

   </li>
   <li class="listitem">
    <span class="simpara">
     <strong><code>OPENSSL_KEYTYPE_EC</code></strong>, 一个额外的键为 <em>&quot;ec&quot;</em> 的数组,包含如下的密钥数据。
    </span>
     <table class="doctable informaltable">
      
       <thead>
        <tr>
         <th>Key</th>
         <th>说明</th>
        </tr>

       </thead>

       <tbody class="tbody">
        <tr>
         <td><em>&quot;curve_name&quot;</em></td>
         <td>name of curve, see <span class="function"><a href="openssl_get_curve_names.html" class="function">openssl_get_curve_names()</a></span></td>
        </tr>

        <tr>
         <td><em>&quot;curve_oid&quot;</em></td>
         <td>ASN1 Object identifier (OID) for EC curve.</td>
        </tr>

        <tr>
         <td><em>&quot;x&quot;</em></td>
         <td>x coordinate (public)</td>
        </tr>

        <tr>
         <td><em>&quot;y&quot;</em></td>
         <td>y coordinate (public)</td>
        </tr>

        <tr>
         <td><em>&quot;d&quot;</em></td>
         <td>private key</td>
        </tr>

       </tbody>
      
     </table>

   </li>
  </ul>
 </div>


</div></div></div></body></html>